package cn.lyd.service.impl;

import cn.lyd.domain.Dept;
import cn.lyd.mapper.DeptMapper;
import cn.lyd.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class DeptServiceImpl implements IDeptService {

    @Autowired
    private DeptMapper deptMapper;


    @Override
    public List<Dept> findAll() {
        return deptMapper.findAll();
    }

    @Override
    public Dept loadById(Long deptid) {
        return deptMapper.loadById(deptid);
    }

    @Override
    @Transactional
    public void save(Dept dept) {
        deptMapper.save(dept);
    }

    @Override
    @Transactional
    public void update(Dept dept) {
        deptMapper.update(dept);
    }

    @Override
    @Transactional
    public void delete(Long deptid) {
        deptMapper.delete(deptid);
    }
}
